package com.raysun.androidbase.interaction

import android.app.Activity
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.raysun.androidbase.databinding.ActivityExtensionBinding

class ExtensionActivity : AppCompatActivity() {

    private lateinit var binding: ActivityExtensionBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityExtensionBinding.inflate(layoutInflater)
        setContentView(binding.root)

        if (intent?.type?.startsWith("image/") == true) {
            Toast.makeText(this, "image/", Toast.LENGTH_LONG).show()
        } else if (intent?.type == "text/plain") {
            Toast.makeText(this, "text/plain", Toast.LENGTH_LONG).show()
        } else {
            Toast.makeText(this, "others", Toast.LENGTH_LONG).show()
        }

        binding.navigateUp.setOnClickListener {
            finish()
        }

        binding.publish.setOnClickListener {
            setResult(Activity.RESULT_OK, null)
            finish()
        }
    }
}